﻿using Abide.Classes;
using System;
using System.Diagnostics;
using System.Security.Permissions;
using System.Windows.Forms;

namespace Abide.Forms
{
    public partial class AssociationForm : Form
    {
        public AssociationForm()
        {
            InitializeComponent();
        }

        private void ApplyButton_Click(object sender, EventArgs e)
        {
            if (MapBox.Checked)
                Classes.Registration.RegisterMap();

            if (AaoBox.Checked)
                Classes.Registration.RegisterAao();

            if (AteBox.Checked)
                Classes.Registration.RegisterAte();

            //Show Message
            if (MapBox.Checked | AaoBox.Checked | AteBox.Checked)
            {
                if (MessageBox.Show("It's highly reccomended that Explorer is restarted. Would you like to do that now?",
                    "Restart Explorer?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    Process[] Explorer = Process.GetProcessesByName("explorer");
                    if (Explorer.Length > 0)
                        Explorer[0].Kill();
                }
            }
        }
    }
}
